import { createRequire } from "node:module"

const require = createRequire(import.meta.url)
// @ts-ignore
const lib = require('../index.node')

/**
 * @returns {{
 *     type: "text" | "richtext" | "image";
 *     data: any;
 * }}
 */
export function readClipboard() {
    return lib.readClipboard()
}

/**
 * 写入剪贴板内容
 * @param {'text'|'richtext'|'image'} type
 * @param {string|Buffer} data
 */
export function writeClipboard(type, data) {
    return lib.writeClipboard(type, data)
}

/**
 * @param {string} text 
 */
export function writeClipboardText(text) {
    return lib.writeClipboardText(text)
}

export function readClipboardText() {
    return lib.readClipboardText()
}

export function readClipboardHtml() {
    return lib.readClipboardHtml()
}

/**
 * @returns {Buffer<ArrayBuffer>} png buffer
 */
export function readClipboardImage() {
    return lib.readClipboardImage()
}
